This example places five copies of MyObject in a row spaced three units apart in the x direction.
Where STRING is any valid string of text including string identifiers or functions which return strings.
For example:
There are seven distinct text streams that POV-Ray uses for output. You may output only to five of them. On some versions of POV-Ray, each stream is designated by a particular color. Text from these streams are displayed whenever it is appropriate so there is often an intermixing of the text. The distinction is only important if you choose to turn some of the streams off or to direct some of the streams to text files. On some systems you may be able to review the streams separately in their own scroll-back buffer. See "Console Text Output" for details on re-directing the streams to a text file.
Here is a description of how POV-Ray uses each stream. You may use them for whatever purpose you want except note that use of the #fatal stream causes a fatal error after the text is displayed.
FATAL: This stream displays fatal error messages. After displaying this text, POV-Ray will terminate. When the error is a scene parsing error, you may be shown several lines of scene text that leads up to the error.
RENDER: This stream displays information about what options you have specified to render the scene. It includes feedback on all of the major options such as scene name, resolution, animation settings, anti-aliasing and others.
STATISTICS: This stream displays statistics after a frame is rendered. It includes information about the number of rays traced, the length of time of the processing and other information.
WARNING: This stream displays warning messages during the parsing of scene files and other warnings. Despite the warning, POV-Ray can continue to render the scene.
The BANNER and STATUS streams can not be accessed by the user.
"\a" | Bell or alarm, 0x07 |
"\b" | Backspace, 0x08 |
"\f" | Form feed, 0x0C |
"\n" | New line (line feed) 0x0A |
"\r" | Carriage return 0x0D |
"\t" | Horizontal tab 0x09 |
"\v" | Vertical tab 0x0B |
"\0" | Null 0x00 |
"\\" | Backslash 0x5C |
"\'" | Single quote 0x27 |
For example:
Locations within that coordinate system are usually specified by a three component vector. The three values correspond to the x, y and z directions respectively. For example, the vector <1,2,3> means the point that's 1 unit to the right, 2 units up, and 3 units in front the center of the "universe" at <0,0,0>.
Vectors are not always points, though. They can also refer to an amount to size, move, or rotate a scene element or to modify the texture pattern applied to an object.
The supported transformations are rotate, scale, and translate. They are used to turn, size, and translate an object or texture. A transformation matrix may also be used to specify complex transformations directly.
Will move the sphere from <10,10,10> to <-5,12,11>. It does not move it to absolute location <-5,2,1>. Translating by zero will leave the element unchanged on that axis. For example:
Scale, is used to "stretch" or "squish" an element. Values larger than 1 stretch the element on that axis. Values smaller than one are used to squish the element on that axis. Scale is relative to the current element size. If the element has been previously re-sized using scale, then scale will size relative to the new size. Multiple scale values may used.
For example:
This stretches and smashes the sphere into an ellipsoid shape that is twice the original size along the x direction, remains the same size in the y direction, and is half the original size in the z direction.
If a lone float expression is specified, it is promoted to a 3 component vector whose terms are all the same. Thus the item is uniformly scaled by the same amount in all directions. For example:
Note that the order of the rotations does matter. Rotations occur about the x axis first, then the y axis, then the z axis. If you are not sure if this is what you want then you should only rotate on one axis at a time using multiple rotation statements to get a correct rotation. As in,
Rotation is always performed relative to the axis. Thus if an object is some distance from the axis of rotation, its will not only rotate but it will "orbit" about the axis as though it was swinging around on an invisible string.
To work out the rotation directions, you must perform the famous "Computer Graphics Aerobics" exercise. Hold up your left hand. Point your thumb in the positive direction of the axis of rotation. Your fingers will curl in the positive direction of rotation. Similarly if you point your thumb in the negative direction of the axis your fingers will curl in the negative direction of rotation. This is the famous "left-hand coordinate system".
In this illustration, the left hand is curling around the x axis. The thumb points in the positive x direction and the fingers curl over in the positive rotation direction.
If you want to use a right hand system, as some CAD systems such as AutoCAD do, the right vector in the camera specification needs to be changed. See the detailed description of the camera. In a right handed system you use your right hand for the "Aerobics".
Where M00 through M32 are float expressions that specify the elements of a 4x4 matrix with the fourth column implicitly <0,0,0,1>. A point P=<px, py, pz> is transformed into Q=(qx, qy, qz) by
qx = M00 * px + M10 * py + M20 * pz + M30 qy = M01 * px + M11 * py + M21 * pz + M31 qz = M02 * px + M12 * py + M22 * pz + M32
Normally you won't use the matrix keyword because it's less descriptive than the transformation commands and harder to visualize. There is an intersecting aspect of the matrix command though. It allows more general transformation like shearing. The following matrix causes an object to be sheared along the y axis.
Similarly scaling after translation also moves an object unexpectedly. Ifyou scale after you translate, the scale will multiply the translate amount. For example:
Will translate to 20, 24, 28 instead of 5, 6, 7. Be careful when transforming to get the order correct for your purposes.
Where IDENT is the identifier to be declared and TRANSFORMATION is one or more translate, rotate, scale or matrix specifications or a previously declared transform identifier. A transform identifier is invoked by the transform keyword without any brackets as shown here:
On extremely complex CSG objects with lots of components, it may speed up parsing if you apply a declared transformation rather than the individual translate, rotate, scale or matrix specifications. The transform is attached just once to each component. Applying each individual translate, rotate, scale or matrix specifications takes long. This only affects parsing --- rendering works the same either way.
Transformations may also be independently applied to pigment patterns and surface normal (bump) patterns. Note scaling a normal pattern affects only the width and spacing. It does not affect the apparent height or depth of the bumps. For example: